//
//  InfoDetail.m
//  Trading365
//
//  Created by Jason on 12-2-3.
//  Copyright (c) 2012年 dhc. All rights reserved.
//

#import "QuotationInfo.h"
#import "QuotationBar.h"
#import "Type.h"

@implementation QuotationInfo
@synthesize quotInfo0,quotInfo1,quotInfo2,quotInfo3;
//@synthesize InfoListTitle,InfoListName;
//@synthesize responseParam;
@synthesize quotationID,quotationNO;

#pragma mark - View lifecycle

- (void)viewDidLoad
{
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
    self.view.backgroundColor=BACKGROUND_COLOR;
    
    //TabBar
    QuotationBar* titleBar = [[QuotationBar alloc] init];
    self.navigationItem.titleView = titleBar.view;
    titleBar.newinfo = self;  
    [titleBar release];

    quotInfo0 = [[QuotationInfo0 alloc] init];
    quotInfo0.quotationInfo=self;
    [quotInfo0 setQuotationID0:self.quotationID];
    [quotInfo0 refreshData];

    quotInfo1 = [[QuotationInfo1 alloc] init];
    quotInfo1.quotationInfo=self;
    quotInfo2 = [[QuotationInfo2 alloc] init];
    quotInfo2.quotationInfo=self;
    quotInfo3 = [[QuotationInfo3 alloc] init];
    quotInfo3.quotationInfo=self;
    
    [self changeType:0];
    
}

- (void)viewDidUnload
{
    [super viewDidUnload];
    // Release any retained subviews of the main view.
    // e.g. self.myOutlet = nil;
}

- (void)dealloc {
//    [responseParam release];
//    [InfoListTitle release];
//    [InfoListName release];
    
    [quotInfo0 release];
    [quotInfo1 release];
    [quotInfo2 release];
    [quotInfo3 release];
    
    [quotationID release];
    [quotationNO release];
//    [super dealloc];
}

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    // Return YES for supported orientations
    return (interfaceOrientation == UIInterfaceOrientationPortrait);
}


#pragma mark - 
#pragma mark - my func

-(void)changeType:(int)type
{
    
//    self.navigationItem.leftBarButtonItem.enabled=NO;
    
    [quotInfo0.view removeFromSuperview];
    [quotInfo1.view removeFromSuperview];
    [quotInfo2.view removeFromSuperview];
    [quotInfo3.view removeFromSuperview];
    
    switch (type) {
        case 0:
            [quotInfo0 setQuotationID0:self.quotationID];
            [quotInfo0 refreshData];
            [self.view addSubview:quotInfo0.view];
            break;
         
        case 1:
            [quotInfo1 setQuotationID1:self.quotationID];
            [quotInfo1 refreshData];
            [self.view addSubview:quotInfo1.view];
            break;
            
        case 2:
            [quotInfo2 setQuotationNO2:self.quotationID];
            [quotInfo2 refreshData];
            [self.view addSubview:quotInfo2.view];
            break;
            
        case 3:
            [quotInfo3 setQuotationNO3:self.quotationID];
            [quotInfo3 refreshData];
            [self.view addSubview:quotInfo3.view];
            break;
            
        default:
            break;
    }
}

@end
